﻿var formLoaded = function (store, records) {
    if (records.length > 0) {
        LvlCfgForm.form.loadRecord(records[0]);
        LvlCfgStore.loaded = false;
    } else {
        LvlCfgForm.form.reset();
        LvlCfgStore.removeAll();
    }
    LvlCfgForm.el.unmask();
};

var successHandler = function (form, action) {
    window.parent.EditLvlWnd.hide();
    window.parent.GridPanel1.store.reload();
};

var adjustData = function (ctrl, value) {
    var ctval = parseInt(value);
    if (ctval < 1) {
        ctval = 1;
        ctrl.setValue(ctval);
    }
    else if (ctval > 255) {
        ctval = 255;
        ctrl.setValue(ctval);
    }
}